/******
    ************************************************************************
    ******
    ** @project : XDrive_Step
    ** @brief   : Stepper motor with multi-function interface and closed loop function. 
    ** @brief   : 具有多功能接口和闭环功能的步进电机
    ** @author  : unlir (知不知啊)
    ** @contacts: QQ.1354077136
    ******
    ** @address : https://github.com/unlir/XDrive
    ******
    ************************************************************************
    ******
    ** {Stepper motor with multi-function interface and closed loop function.}
    ** Copyright (c) {2020}  {unlir(知不知啊)}
    ** 
    ** This program is free software: you can redistribute it and/or modify
    ** it under the terms of the GNU General Public License as published by
    ** the Free Software Foundation, either version 3 of the License, or
    ** (at your option) any later version.
    ** 
    ** This program is distributed in the hope that it will be useful,
    ** but WITHOUT ANY WARRANTY; without even the implied warranty of
    ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ** GNU General Public License for more details.
    ** 
    ** You should have received a copy of the GNU General Public License
    ** along with this program.  If not, see <http://www.gnu.org/licenses/>.
    ******
    ************************************************************************
******/

/*****
  ** @file     : control_config.c/h
  ** @brief    : 控制配置
  ** @versions : 2.2.3
  ** @time     : 2020/09/15
  ** @reviser  : unli (HeFei China)
  ** @explain  : null
*****/

//Oneself
#include "control_config.h"

MotorConfig g_motor_config = {2000,1500,256,50,1000,1000,20,20}; // 声明全局配置实例

// 获取额定电流
int32_t getCurrentRatedCurrent(void) {
  return g_motor_config.Rated_Current;
}

// 获取校准电流
int32_t getCurrent_Cali_Current(void) {
  return g_motor_config.Cali_Current;
}

// 获取使用的电机单圈步数
// int32_t getMoveStepNum(void) {
//   return g_motor_config.Step_NUM;
// }

// 获取每步柔性件控制细分量
int32_t getMoveDivideNum(void) {
  return g_motor_config.Divide_NUM;
}

// 获取电机单圈脉冲数
int32_t getMovePulseNum(void) {
  return Move_Step_NUM * getMoveDivideNum();
}

// 获取额定转速
int32_t getMoveRatedSpeed(void) {
  return g_motor_config.Rated_Speed * getMovePulseNum();
}

// 获取固件额定加速加速度
int32_t getMoveRatedUpAcc(void) {
  return g_motor_config.Rated_UpAcc * getMovePulseNum();
}

// 获取固件额定减速加速度
int32_t getMoveRatedDownAcc(void) {
  return g_motor_config.Rated_DownCurrentRate * getMovePulseNum();
}

// 获取固件额定增流梯度
int32_t getMoveRatedUpCurrentRate(void) {
  return g_motor_config.Rated_UpCurrentRate * getCurrentRatedCurrent();
}

// 获取固件额定减流梯度
int32_t getMoveRatedDownCurrentRate(void) {
  return g_motor_config.Rated_DownCurrentRate * getCurrentRatedCurrent();
}


///**
//  * @brief  控制静态配置
//  * @param  NULL
//  * @retval NULL
//**/
//void Control_Config_Init_Static(void)
//{
//}

///**
//  * @brief  控制动态配置 
//  * @param  NULL
//  * @retval NULL
//**/
//void Control_Config_Init_Dynamic(void)
//{
//}
